using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo02
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
             * 编写一个程序，请用户输入一个四位整数，
             * 将用户输入的四位数的千位、百位、十位和个位分别显示出来，
             * 如5632，则显示“用户输入的千位为5，百位为6，十位为3，个位为2”
            Console.WriteLine("请输入一个四位整数:");
            int num = int.Parse(Console.ReadLine());
            int a = num / 1000;
            int b = (num - a * 1000) / 100;
            int c = (num - a * 1000 - b * 100) / 10;
            int d = (num - a * 1000 - b * 100 - c * 10) / 1;

            Console.WriteLine("千位为:" + a);
            Console.WriteLine("百位为:" + b);
            Console.WriteLine("十位为:" + c);
            Console.WriteLine("个位为:" + d);
             */

            Console.WriteLine("请输入一个四位整数:");
            int dd = int.Parse(Console.ReadLine());
            int o = dd / 1000;
            int p = dd % 1000/100;
            int q = dd % 100 / 10;
            int r = dd % 10;

            Console.WriteLine("千位为:" + o);
            Console.WriteLine("百位为:" + p);
            Console.WriteLine("十位为:" + q);
            Console.WriteLine("个位为:" + r);
        }
    }
}
